//c++ string 智能字符串

#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    const char *s1 = "abcd";
    char s2[8] = "abcd";
    cout << sizeof(s2) << endl;//8
    cout << strlen(s2) << endl;//4

    string s = "abcd";
    s += "xyz"; //字符串可以直接拼接
    s = s + "123";

    string s3;
    s3 = s;
    cout << s << endl;
    cout << s3 <<endl;

    //可动态调整容量空间
    string s6;
    cin >> s6;
    cout << s6.capacity() <<endl; //字符串存放容量
    cout << s6.length() <<endl; //字符串长度

    //可以直接进行比较
    string s10 = "abc";
    string s11 = "aBc";
    if(s10 == s11)
        cout << "yes" << endl;
    else
        cout << "no" << endl;

    s10[1] = 'B';
    if(s10 == s11)
        cout << "yes" << endl;
    else
        cout << "no" << endl;

    return 0;
}